import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)

/**
 * Write a description of class lobster here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class lobster extends Actor
{
    /**
     * Act - do whatever the lobster wants to do. This method is called whenever
     * the 'Act' or 'Run' button gets pressed in the environment.
     */
    public void act() 
    {
       move(4);
       randomTurn();
       keyControl();
       removeTouching(worm.class);
    }
   
    public void randomTurn() {
      if(Greenfoot.getRandomNumber(100) < 30) {
         turn(Greenfoot.getRandomNumber(50) - (30));
      }
    }
    public void keyControl(){
      if(Greenfoot.isKeyDown("left")) {
         turn(-20);
      }
      if(Greenfoot.isKeyDown("right")) {
         turn(20);
      }
    }
}    

